/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Engine2D.gui;

import Engine2D.engine.Engine;
import Engine2D.graphics.GLColour;

/**
 *
 * @author Garys
 */
public class BasicComponent extends AbstractComponent  {

    /**
     * 
     */
    protected int x;
    /**
     * 
     */
    protected int y;
    /**
     * 
     */
    protected int width;
    /**
     * 
     */
    protected int height;
    
    
    /**
     * 
     * @param x
     * @param y
     * @param width
     * @param height
     */
    public BasicComponent(int x, int y, int width, int height){
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }
    
    
    /**
     * 
     * @param x
     * @param y
     */
    @Override
    public void render(int x, int y) {
        Engine.getInstance().drawQuad(x-3, y-3, 300, 400, GLColour.WHITE);
        Engine.getInstance().drawQuad(x, y, 200, 200, GLColour.GREEN);
    }

    /**
     * 
     * @param x
     * @param y
     */
    @Override
    public void setLocation(int x, int y) {
        this.x = x;
        this.y = y;
    }

    /**
     * 
     * @return
     */
    @Override
    public int getX() {
        return x;
    }

    /**
     * 
     * @return
     */
    @Override
    public int getY() {
        return y;
    }

    /**
     * 
     * @return
     */
    @Override
    public int getWidth() {
        return width;
    }

    /**
     * 
     * @return
     */
    @Override
    public int getHeight() {
        return height;
    }
    
    /**
     * 
     * @param x
     * @param y
     * @param newX
     * @param newY
     */
    @Override
    public void mouseDragged(int x, int y, int newX, int newY) {
        setLocation(newX, 600-newY);
    }
    
    /**
     * 
     * @param mouseButton
     * @param pressedX
     * @param pressedY
     */
    @Override
    public void mousePressed(int mouseButton, int pressedX, int pressedY) {
        setLocation(x+pressedX, y+(600-pressedY));
    }
}
